//点击订单详情信息
function selectClientOrderDetail($id){
	var obj = $("#bag").html("");
	obj.load("clientOrderDetailMapping",function(response,status,xhr){
		var data="clientOrderId="+$id+"&pages=&productName=";
		showAllClientOrderDetailInfo(data);
		$("#quotaId").val($id);
	})
}

//显示客户订单详情信息
function showAllClientOrderDetailInfo($data){
	var obj=$("#clientOrderDetailTable tbody").html("");
	//获取路径
	var url="/trade-wzj-web/tests/findClientOrderDetailById";
	//获取参数
	var data=$data;
	//定义字符串拼接
	var str="";
	//调用提交方法
	var result = postMethod(url,"POST",data);
	//获取集合
	var list=result.list;
	console.info(list);
	if(list.length==0){
		alert("对不起，查询数据不存在");
		return;
	}
	if(list.length>0){
		
		for(var i=0;i<list.length;i++){
			str=str+"<tr>" +
						"<td><input type='hidden' id='clientQuotaID' value='"+list[i].clientQuotaID+"'>"+list[i].productInfoQuota.productName+"</td>"+
						"<td>"+list[i].productInfoQuota.supplierQuota.supplierInfo.supplierName+"</td>"+
						"<td>"+list[i].productNum+"</td>"+
						"<td>"+list[i].unit+"</td>"+
						"<td>"+list[i].orderPrice+"</td>"+
						"<td>"+list[i].rental+"</td>"+
						"<td>"+list[i].clientOrderInfo.deliveryDate+"</td>"+
						"<td>"+list[i].state.stateInfo+"</td>"+
					"</tr>";
			
		}
		//订单编号
		var no=$("#orderNo").html("");
		var orderNo=list[0].clientOrderInfo.clientOrderNo;
		no.append(orderNo);
		//订单日期
		var da=$("#orderDates").html("");
		var d=list[0].clientOrderInfo.orderDate;
		da.append(d);
	}
	var page=$("#clientOrdeDetailrPage").html("");
	//调用分页代码
	var va=getPageClientOrderDetail(result);
	page.append(va);
	obj.append(str);
}

//获取页码信息
function getPageClientOrderDetail($clientList){
	var page="";
	
	var con = $("#clientDetailProductName").val();
	page = page+"<div class='row' style='margin:0px'>" +
	"<div class='col-md-2 col-sm-2 col-xs-2' style='padding-top:0.7rem'>"+
		"<span style='font-weight:bold'>总记录数 "+$clientList.total+"   |  总页数 "+$clientList.pages+"</span>"+
	"</div>"+
	"<div class='col-md-offset-8 col-sm-offset-8 col-xs-offset-8'>"
	+"<nav aria-label='Page navigation'>"+
"<ul class='pagination pagination-sm'>";
	if($clientList.prePage>0){
		page = page+"<li><a href='#' onclick='getPagesClientOrderDetail("+$clientList.firstPage+",\""+con+"\")'>首页</a></li>"+
		"<li><a href='#' onclick='getPagesClientOrderDetail("+$clientList.prePage+",\""+con+"\")'>上一页</a></li>";
				
	}
	if($clientList.nextPage<=$clientList.lastPage && $clientList.nextPage>0){
		page = page+"<li><a href='#' onclick='getPagesClientOrderDetail("+$clientList.nextPage+",\""+con+"\")'>下一页</a></li>"+
		"<li><a href='#' onclick='getPagesClientOrderDetail("+$clientList.lastPage+",\""+con+"\")'>末页</a></li>";
	}
	page = page+"</li>"+
"</ul>"+
"</nav>"+
"</div>"+
"</div>";
	return page;
	
}

//分页功能
function getPagesClientOrderDetail($page,$object){
	var data="clientOrderId="+$("#clientQuotaID").val()+"&pages="+$page+"&productName="+$object;
	showAllClientOrderDetailInfo(data);
}

//查询订单详情
function findClientOrs(){
	var o=$("#clientDetailProductName").val();
	var data="clientOrderId="+$("#quotaId").val()+"&pages=&productName="+o;
	showAllClientOrderDetailInfo(data);
}